import random  # 导入随机数的模块 random
all_choices = ["石头", "剪刀", "布"]  # 存储出拳的每个选择
# 定义列表win_list, 将玩家赢电脑的选择，提前保存起来
# 每个子列表中，玩家为第一个元素，电脑为第二个元素
win_list = [["石头", "剪刀"], ["剪刀", "布"], ["布", "石头"]]
# 随机选出一个元素，随机出来的元素为电脑的出拳
computer = random.choice(all_choices)
print("computer:", computer)
# 获取用户的出拳选择
player = input("请出拳(石头/剪刀/布):")
if player == computer:
    print("平局")
elif [player, computer] in win_list:
    print("玩家胜")
else:
    print("计算机胜")